home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacApp / MacApp CD Release / MacApp 2.0.1 (Many Libraries) / Examples / Calc / MCalc.p < prev    next >
Encoding:
Text File  |  1990-10-25  |  2.3 KB  |  70 lines  |  [TEXT/MPS ]

  1. {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
  2. { MCalc.p }
  3. { Copyright © 1985 - 1990 by Apple Computer, Inc. All rights reserved. }
  4.  
  5. PROGRAM SpreadSheet;
  6.  
  7.   {$MC68020-}                                            { The main program must be universal code }
  8.   {$MC68881-}
  9.  
  10.     USES
  11.         { • Required for this unit's interface }
  12.  
  13.         { • MacApp }
  14.         UMacApp,
  15.  
  16.         { • Building Blocks }
  17.         UPrinting, UGridView, UTEView,
  18.  
  19.         { • Implementation use }
  20.         Sane, UCalc, USynchScroller;
  21.  
  22.     CONST
  23.         phSplash            = 1001;                     { Application's splash screen }
  24.  
  25.     VAR
  26.         gCalcApplication:    TCalcApplication;            { The application object }
  27.  
  28.     PROCEDURE InitWithSplashScreen;
  29.     { 1. To avoid heap fragmentation, we allocate space for the DialogRecord on the stack,
  30.       as a local variable in this procedure, so that the dialog record *won't* be allocated
  31.       as a non-relocatable block at the bottom of the heap.
  32.       2. If we were to pass NIL to GetNewCenteredDialog for the dStorage, then the call to
  33.       GetNewDialog would allocate the dialog record as a non-relocatable block at the bottom
  34.       of the heap leading to heap fragmentation during InitUMacApp's call to MoreMasters. }
  35.  
  36.         VAR
  37.             theDialogRecord:    DialogRecord;            { allocated on the stack }
  38.  
  39.         BEGIN
  40.         IF (GetNewCenteredDialog(phSplash, @theDialogRecord, Pointer(-1)) <> NIL) THEN
  41.             DrawDialog(@theDialogRecord);                { Show splash screen }
  42.  
  43.         { Continue with remainder of initialization }
  44.         InitUMacApp(25);                                { Initialize MacApp; call MoreMasters 25
  45.                                                          times }
  46.         InitUTEView;                                    { Initialize TEView unit }
  47.         InitUGridView;                                    { Initialize the GridView unit }
  48.         InitUSynchScroller;                                { Initialize that unit, too }
  49.         InitUPrinting;                                    { Initialize the Printing unit }
  50.  
  51.         New(gCalcApplication);                            { Allocate the Application object }
  52.         FailNil(gCalcApplication);
  53.         gCalcApplication.ICalcApplication(kFileType);    { Initialize the application }
  54.  
  55.         DisposDialog(@theDialogRecord);                 { Remember to remove the splash screen }
  56.         END;
  57.  
  58.     BEGIN
  59.     InitToolBox;                                        { Essential toolbox and utilities
  60.                                                          initialization }
  61.     PullApplicationToFront;                             { Pull app to front under MultiFinder™ }
  62.     IF ValidateConfiguration(gConfiguration) THEN        { Make sure we can run }
  63.         BEGIN
  64.         InitWithSplashScreen;
  65.         gCalcApplication.Run;                            { Run the application }
  66.         END
  67.     ELSE
  68.         StdAlert(phUnsupportedConfiguration);
  69.     END.
  70.